package com.xpgk.mvc.leaveApplication;

import java.util.Date;
import java.util.List;

import com.jfinal.log.Log;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.xpgk.annotation.Service;
import com.xpgk.constant.ConstantRender;
import com.xpgk.dto.RenderBean;
import com.xpgk.mvc.base.BaseService;

@Service(name = LeaveApplicationService.serviceName)
public class LeaveApplicationService extends BaseService {
	@SuppressWarnings("unused")
	private static final Log log=Log.getLog(LeaveApplicationService.class);
	
	public static final String serviceName = "leaveApplicationService";	
	/**
	 * 保存请假顾客
	 */
	public RenderBean saveLeave(LeaveApplication leaveApplication,String organid,String customerIds,String name,String phone,String hybh,String createId,String creater,Date createDate){
		RenderBean result=new RenderBean();
		String msg="";
		leaveApplication.set(LeaveApplication.column_organIds, organid);
		leaveApplication.set(LeaveApplication.column_costomerIds, customerIds);
		leaveApplication.set(LeaveApplication.column_name, name);
		leaveApplication.set(LeaveApplication.column_phone, phone);
		leaveApplication.set(LeaveApplication.column_hybh, hybh);
		leaveApplication.set(LeaveApplication.column_createId, createId);
		leaveApplication.set(LeaveApplication.column_creater, creater);
		leaveApplication.set(LeaveApplication.column_createDate, createDate);
		if(leaveApplication.save()){
			msg=ConstantRender.render_success_code;
		}else{
			msg="保存失败";
		}
		result.getMap().put("msg",msg);
		return result;
	}
	/**
	 * 查询本店所有顾客
	 */
	public List<Record> queryCustomer(String organid){
		String sql="SELECT ids,name from sb_customer where organIds="+organid;
		List<Record> customers=Db.find(sql);
		return customers;
	}
}
